/*
 * @Author: NingJian
 * @Date: 2021-07-28 09:49:48
 * @LastEditTime: 2021-07-29 16:59:02
 * @LastEditors: NingJian
 * @Description: 
 * @FilePath: /opencv-as-pillow-resize/src/main.cpp
 * 
 */

#include <iostream>

#include <opencv2/opencv.hpp>

#include "image.h"

using namespace std;


void print_mat_color(cv::Mat &src_image, int r, int c) {
    auto v = src_image.at<cv::Vec3b>(r,c);
   cout << "[ " << (int)v[0] << " " <<  (int)v[1] << " "  <<  (int)v[2] << " ]" << endl;
}

void print_mat_color(Imaging &src_image, int r, int c) {
    auto v = src_image->image[r] + c * src_image->pixelsize;
   cout << "[ " << (int)v[0] << " " <<  (int)v[1] << " "  <<  (int)v[2] << " ]" << endl;

}


int main() {

    std::string im_pth = "./test/im6.bmp";
    cv::Mat src_image = cv::imread(im_pth);

    cv::cvtColor(src_image, src_image, cv::ColorConversionCodes::COLOR_RGB2BGR);
  
    
    for(int w = 0; w < 10; ++w ) {
        print_mat_color(src_image,0,w);
    }

   std::cout << endl;

   cv::Mat des = ImageResize_8UC3(src_image,256, 309);

   

    for(int w = 0; w < 10; ++w ) {
        print_mat_color(des,0,w);
    }
   
   return 0;

}

